package com.ssmtest.mybatis.controller;

import com.ssmtest.mybatis.entities.Employee;
import com.ssmtest.mybatis.service.EmployeeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/11/13 16:30
 */
@Slf4j
@Controller
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    @RequestMapping("/emps")
    public String emps(Map<String, Object> map) {
        List<Employee> employees = employeeService.getAllEmps();
        log.info("employees:{}", Arrays.toString(employees.toArray()));
        map.put("employees", employees);
        return "list";
    }
}
